package cn.du.com.controller;

import cn.du.com.pojo.Student;
import cn.du.com.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: du
 * @Date: 2021/8/16 16:20
 */
@RestController
@RequestMapping("student")
public class StudentController {
    @Autowired
    private StudentService studentService;

    @PostMapping("save")
    public Object save(@RequestBody Student student){
        studentService.save(student);
        return 1;
    }

    @PostMapping("delete")
    public Object delete(@RequestBody Student student){
        studentService.delete(student);
        return 1;
    }

    @GetMapping("findAll")
    public List<Student> findAll(){
        return studentService.findAll();
    }

}
